<TMPL_INCLUDE name=../htmlheader.html>
<script language="JavaScript1.2" src='<TMPL_VAR name=APP_PATH>/js/functions.js' /></script>
<link rel=stylesheet href=<TMPL_VAR name=APP_PATH>/css/style.css type=text/css>
<div id=template_form>
<form method=post action=Templates.pl id=content_form>
<table width=100% border="0">
    <TR>
    <TD><h3>Template Editor</h3><div id=content_status></div></TD>
    <TD style="text-align:right; border:0px solid grey;" colspan="2">
    <form action=editor.cgi>
        <select name=template onChange="get_template(this.value)"  style="width:200px;">
            <OPTION value=<TMPL_VAR name=t_id>><TMPL_VAR name=t_id>. <TMPL_VAR name=t_subject></OPTION>
            <TMPL_LOOP name=TEMPLATES>
                <option value=<TMPL_VAR name=template_id>><TMPL_VAR name=template_id>. <TMPL_VAR name=subject></option>
            </TMPL_LOOP>
            <option value=-1>-- Select Template --</option>
        </select>
    </form> | 
    <div id=action_result style="text-align:right;float:left;padding-left:1em; border:0px solid grey;"></div>
    <!--</TD>-->
    <!--<TD style="text-align:right;">-->
        <input type=submit id=action name=action value='New'> | 
        <input type=button id=btnNewWindow value='New Window' onClick="window.open('<TMPL_VAR name=APP_PATH_CGI>/admin/Templates.pl?action=get_t&t_id=<TMPL_VAR name=t_id>', 'Content Editor', 'width=800px,height=800px,resizable=1');"> |
        <input type=button id=btnPreview value='Preview' onClick="preview_template();"> | 
        <input type="submit" value=Save>
        <input type=hidden id=action name=action value=save_t>
        <input type="hidden" name=t_id value=<TMPL_VAR name=t_id>><br>
        <a href='editor.cgi?action=New_from_template&t_id=<TMPL_VAR name=t_id>' style="font-size:10px;">Create content with this template</a>
    </TD>
    </TR>
</table>

<table width=100% cellpadding="0" cellspacing="3" border=0>
    <tr>
    <!--<td class=smalllabel>Title</td>-->
    <TD class=smalllabel colspan="2">Template Subject</TD>
    </tr>
    <TR>
    <!--<TD width=50%>
            <input id=t_title name=t_title style="width:95%;border:1px lightgrey solid;" value='<TMPL_VAR name=t_title>'>
    </TD>-->
    <TD width=50% style="margin-left:1em;" colspan="2">
            <input id=t_subject name=t_subject style="width:100%;border:1px lightgrey solid;" value='<TMPL_VAR name=t_subject>'>
    </TD>
    </tr>
    <TR>
        <TD colspan="2">
            <textarea id=t_editor name=t_editor style="width:100%;height:450;"><TMPL_VAR name=t_content></textarea>
        </TD>
    </TR>
</table>
</form>
</div>

<script>
function get_template(template_id) 
{
    if (template_id < 0) return;
    window.location = "Templates.pl?action=get_t&t_id=" + template_id;
    return;
}

function preview_template() {
    URL     = 'ContentViewer?t_id=<TMPL_VAR name=t_id>';
    window.open(URL, '', 'width=800,height=600,resizable=1,');
    return;
}
</script>

<script>
tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : "table,advimage,advlink,emotions,iespell,insertdatetime,zoom,flash,searchreplace,print,contextmenu,fullscreen,fullpage",
        theme_advanced_buttons1_add_before : "save,separator",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
        theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
        theme_advanced_buttons3_add_before : "tablecontrols,separator",
        theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator,print,fullscreen,fullpage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_path_location : "bottom",
        plugin_insertdate_dateFormat : "%Y-%m-%d",
        plugin_insertdate_timeFormat : "%H:%M:%S",
        extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        external_link_list_url : "example_data/example_link_list.js",
        external_image_list_url : "example_data/example_image_list.js",
        flash_external_list_url : "example_data/example_flash_list.js",
        verify_html:"false"
});
</script>
